package servlet;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.JspWriter;

import Model.Committee;
import Model.Staff;

/**
 * Servlet implementation class RoleTable
 */

public class CommitteeDropdown extends HttpServlet {
	private static final long serialVersionUID = 1L;
    JspWriter out;   
    /**
     * @see HttpServlet#HttpServlet()
     */
    public CommitteeDropdown() {
        super();
        // TODO Auto-generated constructor stub
    }
    
    public CommitteeDropdown(JspWriter outputStream) {
		// TODO Auto-generated constructor stub
		out = outputStream;
	}

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		javax.servlet.http.HttpSession session = request.getSession();
		String currentUser = session.getAttribute("username").toString();
		
		ArrayList<Committee> committeeTable = new ArrayList<Committee>();
		committeeTable = Database.CommitteeDB.getAllCommittees();
		
		for(int i = 0; i < committeeTable.size(); i++)
		{

			out.print("<option value='" + committeeTable.get(i).getId() + "'>");
				out.print(committeeTable.get(i).getTitle());
			out.print("</option>");

		}
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

}
